﻿using Abp.Application.Navigation;
using Abp.Localization;
using KDS.Mes.Authorization;
using KDS.Mes.Web.Navigation;

namespace KDS.Mes.Web
{
    /// <summary>
    /// This class defines menus for the application. It uses ABP's menu system. When you add menu
    /// items here, they are automatically appear in angular application. See
    /// Views/Layout/_TopMenu.cshtml file to know how to render menu.
    /// </summary>
    public class MesNavigationProvider : NavigationProvider
    {
        public override void SetNavigation(INavigationProviderContext context)
        {
            context.Manager.MainMenu
                .AddItem(
                    new MenuItemDefinition(
                        "Home",
                        L("HomePage"),
                        url: "",
                        icon: "fa fa-home",
                        requiresAuthentication: true
                        )
                ).AddItem(
                new MenuItemDefinition(
                    "Administration",
                    L("Administration"),
                    icon: "fa fa-gear"
                    ).AddItem(
                        new MenuItemDefinition(
                            PageNames.App.Common.Roles,
                            L("Roles"),
                            url: "Roles",
                            icon: "fa fa-circle-o",
                            requiredPermissionName: AppPermissions.Pages_Administration_Roles
                            )
                    ).AddItem(
                        new MenuItemDefinition(
                            PageNames.App.Common.Users,
                            L("Users"),
                            url: "Users",
                            icon: "fa fa-circle-o",
                            requiredPermissionName: AppPermissions.Pages_Administration_Users
                            )
                    )
            ).AddItem(
                new MenuItemDefinition(
                    "Basic",
                    L("Basic"),
                    icon: "fa  fa-dashboard"
                    ).AddItem(
                        new MenuItemDefinition(
                            PageNames.App.Common.Factorys,
                            L("Factorys"),
                            url: "Factorys",
                            icon: "fa fa-circle-o",
                            requiredPermissionName: AppPermissions.Pages_Basic_Factorys
                            )
                    ).AddItem(
                        new MenuItemDefinition(
                            PageNames.App.Common.Workshops,
                            L("Workshops"),
                            url: "Workshops",
                            icon: "fa fa-circle-o",
                            requiredPermissionName: AppPermissions.Pages_Basic_Workshops
                            )
                    ).AddItem(
                            new MenuItemDefinition(
                            PageNames.App.Common.Lines,
                            L("Lines"),
                            url: "Lines",
                            icon: "fa fa-circle-o",
                            requiredPermissionName: AppPermissions.Pages_Basic_Lines)
                    ).AddItem(
                            new MenuItemDefinition(
                            PageNames.App.Common.Stations,
                            L("Stations"),
                            url: "Stations",
                            icon: "fa fa-circle-o",
                            requiredPermissionName: AppPermissions.Pages_Basic_Stations)
                    ).AddItem(
                            new MenuItemDefinition(
                            PageNames.App.Common.Storages,
                            L("Storages"),
                            url: "Storages",
                            icon: "fa fa-circle-o",
                            requiredPermissionName: AppPermissions.Pages_Basic_Storages)
                            )
               ).AddItem(
                new MenuItemDefinition(
                    "Bom",
                    L("Bom"),
                    icon: "fa fa-black-tie"
                    ).AddItem(
                        new MenuItemDefinition(
                            PageNames.App.Common.Colors,
                            L("Colors"),
                            url: "Colors",
                            icon: "fa fa-circle-o",
                            requiredPermissionName: AppPermissions.Pages_Bom_Colors
                            )
                    ).AddItem(
                        new MenuItemDefinition(
                            PageNames.App.Common.Materials,
                            L("Materials"),
                            url: "Materials",
                            icon: "fa fa-circle-o",
                            requiredPermissionName: AppPermissions.Pages_Bom_Materials
                            )
                    ).AddItem(
                        new MenuItemDefinition(
                            PageNames.App.Common.Cartypes,
                            L("Cartypes"),
                            url: "Cartypes",
                            icon: "fa fa-circle-o",
                            requiredPermissionName: AppPermissions.Pages_Bom_Cartypes
                            )
                    )
                    //.AddItem(
                    //     new MenuItemDefinition(
                    //         PageNames.App.Common.Alcs,
                    //         L("Alcs"),
                    //         url: "Alcs",
                    //         icon: "fa fa-circle-o",
                    //         requiredPermissionName: AppPermissions.Pages_Bom_Alcs
                    //         )
                    // ) 
                     .AddItem(
                               new MenuItemDefinition(
                               PageNames.App.Common.Styles,
                               L("Styles"),
                               url: "Styles",
                               icon: "fa fa-circle-o",
                               requiredPermissionName: AppPermissions.Pages_Bom_Styles)
                     ).AddItem(
                               new MenuItemDefinition(
                               PageNames.App.Common.AlcCodes,
                               L("AlcCodes"),
                               url: "AlcCodes",
                               icon: "fa fa-circle-o",
                               requiredPermissionName: AppPermissions.Pages_Bom_AlcCodes)
                     ).AddItem(
                               new MenuItemDefinition(
                               PageNames.App.Common.SeatPositions,
                               L("SeatPositions"),
                               url: "SeatPositions",
                               icon: "fa fa-circle-o",
                               requiredPermissionName: AppPermissions.Pages_Bom_SeatPositions)
                     ).AddItem(
                               new MenuItemDefinition(
                               PageNames.App.Common.Parts,
                               L("Parts"),
                               url: "Parts",
                               icon: "fa fa-circle-o",
                               requiredPermissionName: AppPermissions.Pages_Bom_Parts)
                     ).AddItem(
                               new MenuItemDefinition(
                               PageNames.App.Common.SeatInfos,
                               L("SeatInfos"),
                               url: "SeatInfos",
                               icon: "fa fa-circle-o",
                               requiredPermissionName: AppPermissions.Pages_Bom_SeatInfos)
                     ).AddItem(
                               new MenuItemDefinition(
                               PageNames.App.Common.ProcessTypes,
                               L("ProcessTypes"),
                               url: "ProcessTypes",
                               icon: "fa fa-circle-o",
                               requiredPermissionName: AppPermissions.Pages_Bom_ProcessTypes)
                     ).AddItem(
                               new MenuItemDefinition(
                               PageNames.App.Common.ProductModes,
                               L("ProductModes"),
                               url: "ProductModes",
                               icon: "fa fa-circle-o",
                               requiredPermissionName: AppPermissions.Pages_Bom_ProductModes)
                     ).AddItem(
                               new MenuItemDefinition(
                               PageNames.App.Common.JitAlcCodes,
                               L("JitAlcCodes"),
                               url: "JitAlcCodes",
                               icon: "fa fa-circle-o",
                               requiredPermissionName: AppPermissions.Pages_Bom_JitAlcCodes)
                     )

               ).AddItem(
                new MenuItemDefinition(
                    "Plan",
                    L("Plan"),
                    icon: "fa fa-compass"
                    ).AddItem(
                        new MenuItemDefinition(
                            PageNames.App.Common.PlanModes,
                            L("PlanModes"),
                            url: "PlanModes",
                            icon: "fa fa-circle-o",
                            requiredPermissionName: AppPermissions.Pages_Plan_PlanModes)
                    )
                    .AddItem(
                        new MenuItemDefinition(
                            PageNames.App.Common.Plans,
                            L("Plans"),
                            url: "Plans",
                            icon: "fa fa-circle-o",
                            requiredPermissionName: AppPermissions.Pages_Plan_Plans)
                    )
                    .AddItem(
                        new MenuItemDefinition(
                            PageNames.App.Common.Onlines,
                            L("Onlines"),
                            url: "Onlines",
                            icon: "fa fa-circle-o",
                            requiredPermissionName: AppPermissions.Pages_Plan_Onlines
                            )
                    ).AddItem(
                        new MenuItemDefinition(
                            PageNames.App.Common.SeqJits,
                            L("SeqJits"),
                            url: "SeqJits",
                            icon: "fa fa-circle-o",
                            requiredPermissionName: AppPermissions.Pages_Plan_SeqJits
                            )
                    ).AddItem(
                    new MenuItemDefinition(
                            PageNames.App.Common.Andon,
                            L("ANDON"),
                            url: "ANDON",
                            icon: "fa fa-circle-o",
                            requiredPermissionName: AppPermissions.Pages_ANDON
                            )
                              
                    ).AddItem(
                    new MenuItemDefinition(
                            PageNames.App.Common.StopEquipment,
                            L("StopEquipment"),
                            url: "StopEquipments",
                            icon: "fa fa-circle-o",
                            requiredPermissionName: AppPermissions.Pages_StopEquipment
                            )

                    )
                ).AddItem(
                new MenuItemDefinition(
                    "Report",
                    L("Report"),
                    icon: "fa  fa-line-chart"
                    ).AddItem(
                        new MenuItemDefinition(
                            PageNames.App.Common.TestSlides,
                            L("TestSlides"),
                            url: "TestSlides",
                            icon: "fa fa-circle-o",
                            requiredPermissionName: AppPermissions.Pages_Report_TestSlides
                            )
                    ).AddItem(
                        new MenuItemDefinition(
                            PageNames.App.Common.TestPower2s,
                            L("TestPower2s"),
                            url: "TestPower2s",
                            icon: "fa fa-circle-o",
                            requiredPermissionName: AppPermissions.Pages_Report_TestPower2s
                            )
                    ).AddItem(
                        new MenuItemDefinition(
                            PageNames.App.Common.TestImss,
                            L("TestImss"),
                            url: "TestImss",
                            icon: "fa fa-circle-o",
                            requiredPermissionName: AppPermissions.Pages_Report_TestImss
                            )
                    ).AddItem(
                        new MenuItemDefinition(
                            PageNames.App.Common.TestRlifts,
                            L("TestRlifts"),
                            url: "TestRlifts",
                            icon: "fa fa-circle-o",
                            requiredPermissionName: AppPermissions.Pages_Report_TestRlifts
                            )
                    ).AddItem(
                        new MenuItemDefinition(
                            PageNames.App.Common.Atlass,
                            L("Atlass"),
                            url: "Atlass",
                            icon: "fa fa-circle-o",
                            requiredPermissionName: AppPermissions.Pages_Report_Atlass
                            )
                    ).AddItem(
                        new MenuItemDefinition(
                            PageNames.App.Common.AtlasCpks,
                            L("AtlasCpks"),
                            url: "AtlasCpks",
                            icon: "fa fa-circle-o",
                            requiredPermissionName: AppPermissions.Pages_Report_AtlasCpks
                            )
                    ).AddItem(
                        new MenuItemDefinition(
                            PageNames.App.Common.Retrospects,
                            L("Retrospects"),
                            url: "Retrospects",
                            icon: "fa fa-circle-o",
                            requiredPermissionName: AppPermissions.Pages_Report_Retrospects
                            )
                    ).AddItem(
                        new MenuItemDefinition(
                            PageNames.App.Common.Reports_UPH,
                            L("Reports_UPH"),
                            url: "Reports_UPH",
                            icon: "fa fa-circle-o",
                            requiredPermissionName: AppPermissions.Pages_Report_Reports_UPH
                            )
                    ).AddItem(
                        new MenuItemDefinition(
                            PageNames.App.Common.Reports_Report,
                            L("Reports_Report"),
                            url: "Reports_Report",
                            icon: "fa fa-circle-o",
                            requiredPermissionName: AppPermissions.Pages_Report_Reports_Report
                            )
                    ).AddItem(
                        new MenuItemDefinition(
                            PageNames.App.Common.Reports_Offline,
                            L("Reports_Offline"),
                            url: "Reports_Offline",
                            icon: "fa fa-circle-o",
                            requiredPermissionName: AppPermissions.Pages_Report_Reports_Offline
                            )
                    )
                //.AddItem(
                //    new MenuItemDefinition(
                //        PageNames.App.Common.Plans,
                //        L("Plans"),
                //        url: "Plans",
                //        icon: "fa fa-circle-o",
                //        requiredPermissionName: AppPermissions.Pages_Plan_Plans
                //        )
                //)
                //.AddItem(
                //    new MenuItemDefinition(
                //        PageNames.App.Common.Onlines,
                //        L("Onlines"),
                //        url: "Onlines",
                //        icon: "fa fa-circle-o",
                //        requiredPermissionName: AppPermissions.Pages_Plan_Onlines
                //        )
                //).AddItem(
                //    new MenuItemDefinition(
                //        PageNames.App.Common.SeqJits,
                //        L("SeqJits"),
                //        url: "SeqJits",
                //        icon: "fa fa-circle-o",
                //        requiredPermissionName: AppPermissions.Pages_Plan_SeqJits
                //        )
                //)
                );
        }

        private static ILocalizableString L(string name)
        {
            return new LocalizableString(name, MesConsts.LocalizationSourceName);
        }
    }
}
